package com.itheima.rabbitmq.producer.service;

import com.itheima.rabbitmq.producer.config.MessageSender;
import com.itheima.rabbitmq.producer.config.RabbitConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created By gao_e on 2020/2/28 15:18
 */
@Service
public class BusinessService {

    @Autowired
    private MessageSender messageSender; // 这个对象在内存中是单例存在的

    public String handle() {

        // 业务操作 service方法

        messageSender.sendMQMessage(RabbitConfig.ITEM_TOPIC_EXCHANGE,
                "item.insert", "商品新增，routing key 为item.insert");

        return null;
    }

}
